package com.atguigu.demo.excel.listener;

import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.atguigu.demo.excel.DemoData;

import java.util.Map;

/**
 * @ClassName ExcelListener
 * @Description TODO
 * @Detail detail
 * @Author MyPC
 * @Date 2020/6/21
 * @Version 1.0
 */
public class ExcelListener extends AnalysisEventListener<DemoData> {

    //一行一行的读取数据，不读取表头
    @Override
    public void invoke(DemoData demoData, AnalysisContext analysisContext) {
        System.out.println(demoData);
    }
    //读取表头
    @Override
    public void invokeHeadMap(Map<Integer, String> headMap, AnalysisContext context) {
        System.out.println(headMap);
    }
    //读取成功后操作
    @Override
    public void doAfterAllAnalysed(AnalysisContext analysisContext) {

    }
}
